package example;


import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import sun.misc.BASE64Encoder;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.ws.Endpoint;
import java.io.*;
import java.lang.reflect.Field;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.logging.Logger;

@WebService
public class TmriOutAccess {
    List<TrffWeb.DriverInfo> list1 = new ArrayList<TrffWeb.DriverInfo>();
    List<TrffWeb.DriverPhoto> list2 = new ArrayList<TrffWeb.DriverPhoto>();
    List<TrffWeb.DrivingLicence> list3 = new ArrayList<TrffWeb.DrivingLicence>();
    List<TrffWeb.CarInfo> list4 = new ArrayList<TrffWeb.CarInfo>();
    List<TrffWeb.IllegalInfo> list5 = new ArrayList<TrffWeb.IllegalInfo>();
    List<TrffWeb.MonitoringInfo> list6 = new ArrayList<TrffWeb.MonitoringInfo>();
    List<TrffWeb.MonitorPhoto> list7 = new ArrayList<TrffWeb.MonitorPhoto>();
    List<TrffWeb.LogInfo> list8 = new ArrayList<TrffWeb.LogInfo>();
    List<TrffWeb.AccountCheck> list9 = new ArrayList<TrffWeb.AccountCheck>();
    List<TrffWeb.CheckDriver> list10 = new ArrayList<TrffWeb.CheckDriver>();
    List<TrffWeb.IllegalCode> list11 = new ArrayList<TrffWeb.IllegalCode>();


    @WebMethod
    public String queryObjectOut(String xtlb, String jkxlh, String jkid, String QueryXmlDoc) {
        String result = "";
        TrffWeb mTrffWeb = new TrffWeb();
        //读取驾驶人基本信息
        if (jkid.equals("02C20")) {
            System.out.println("02C20QueryXmlDoc:" + QueryXmlDoc);
            result = saxParserInput(1, QueryXmlDoc);
            System.out.println("result:" + result);
        }
        //读取驾驶人照片信息
        if (jkid.equals("02C05")) {
            System.out.println("02C05QueryXmlDoc:" + QueryXmlDoc);
            result = saxParserInput(2, QueryXmlDoc);

            System.out.println("result:" + result);
        }
        //读取驾驶证基本信息
        if (jkid.equals("02C06")) {
            System.out.println("02C06QueryXmlDoc:" + QueryXmlDoc);
            result = saxParserInput(3, QueryXmlDoc);
            try {
                System.out.println("result:" + result);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        //读取机动车基本信息查询接口
        if (jkid.equals("01C21")) {
            System.out.println("01C21QueryXmlDoc:" + QueryXmlDoc);
            result = saxParserInput(4, QueryXmlDoc);
            try {
                System.out.println("result:" + result);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        //5查询违法基本信息
        if (jkid.equals("04C01")) {
            System.out.println("04C01QueryXmlDoc:" + QueryXmlDoc);
            result = saxParserInput(5, QueryXmlDoc);
            System.out.println("result:" + result);
        }
        //查询电子监控文本信息
        if (jkid.equals("04C03")) {
            System.out.println("04C03QueryXmlDoc:" + QueryXmlDoc);
            result = saxParserInput(6, QueryXmlDoc);

            System.out.println("result:" + result);
        }
        //查询电子监控照片信息
        if (jkid.equals("04C04")) {
            System.out.println("04C04QueryXmlDoc:" + QueryXmlDoc);
            result = saxParserInput(10, QueryXmlDoc);

            System.out.println("result:" + result);
        }
        //查询日志信息
        if (jkid.equals("04C05")) {
            System.out.println("04C05QueryXmlDoc:" + QueryXmlDoc);
            result = saxParserInput(12, QueryXmlDoc);

            System.out.println("result:" + result);
        }
        //查询银行对账信息
        if (jkid.equals("04C07")) {
            System.out.println("04C07QueryXmlDoc:" + QueryXmlDoc);
            result = saxParserInput(13, QueryXmlDoc);

            System.out.println("result:" + result);
        }
        //14查询驾驶人能否处理接口
        if (jkid.equals("04C77")) {
            System.out.println("04C77QueryXmlDoc:" + QueryXmlDoc);
            result = saxParserInput(14, QueryXmlDoc);

            System.out.println("result:" + result);
        }
        //15违法行为代码查询接口
        if (jkid.equals("04C91")) {
            System.out.println("04C91QueryXmlDoc:" + QueryXmlDoc);
            result = saxParserInput(15, QueryXmlDoc);

            System.out.println("result:" + result);
        }
        return result;
    }


    private String saxParserInput(int type, String result) {
        String result1 = "";
        StringReader sr = new StringReader(result);
        InputSource is = new InputSource(sr);

        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

        try {
            //2.创建一个DocumentBuilder对象
            DocumentBuilder db = dbf.newDocumentBuilder();

            //3.通过DocumentBuilder的parse方法加载books.xml到当前工程目录下
            Document document = db.parse(is);

            //4.获取所有book所有节点的集合
            NodeList bookList = document.getElementsByTagName("QueryCondition");

            //通过NodeList的getLength（）方法获取 bookList的长度
            int bookCnt = bookList.getLength();
            System.out.println("获取了" + bookCnt + "条数据");


            //5.通过item方法获取一个book节点，bookList索引值从0开始
            Node book = bookList.item(0);

            //6.获取book节点的所有属性集合
            NamedNodeMap attrs = book.getAttributes();

            for (int j = 0; j < attrs.getLength(); j++) {
                //7.通过这个item()方法获取book某一个属性
                Node attr = attrs.item(j);

                //8.获取属性名
                System.out.print("属性名：" + attr.getNodeName() + "----");

                //9.获取属性值
                System.out.println("属性值：" + attr.getNodeValue());
            }

            //10.通过getChildNodes()方法解析book节点子节点
            NodeList childNodes = book.getChildNodes();
            System.out.println("NodeList：" + childNodes.getLength());
            result1 = checkNode(type, childNodes);

        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return result1;

    }

    private String checkNode(int type, NodeList childNodes) {
        String result = "";
        TrffWeb mTrffWeb = new TrffWeb();
        if (type == 1) {
            List<TrffWeb.DriverInfo> list = new ArrayList<TrffWeb.DriverInfo>();
            String sfzmhm = "";
            for (int k = 0; k < childNodes.getLength(); k++) {
                //12.区分出text类型和element类型的node
                if (childNodes.item(k).getNodeType() == Node.ELEMENT_NODE) {

                    //13.获取element类型节点的节点名
                    System.out.print("第" + (k + 1) + "节点的节点名：" + childNodes.item(k).getNodeName() + "  ");

                    //14.获取element类型节点的节点值
                    System.out.println("节点值：" + childNodes.item(k).getTextContent());

                    if (childNodes.item(k).getNodeName().equals("sfzmhm")) {
                        sfzmhm = childNodes.item(k).getTextContent();
                    }

                }
            }
            if (isEmpty(sfzmhm)) {
                result = getFailXml("查询条件不能为空");
            } else {
                for (TrffWeb.DriverInfo driverInfo : list1) {
                    if (driverInfo.sfzmhm.equals(sfzmhm)) {
                        list.add(driverInfo);
                    }
                }
                if (list.size() == 0) {
                    result = getFailXml("未查询到结果");
                } else {
                    mTrffWeb.setType(1);
                    result = getSuccessXml(list);
                }
            }
        }
        if (type == 2) {
            List<TrffWeb.DriverPhoto> list = new ArrayList<TrffWeb.DriverPhoto>();
            String sfzmhm = "";
            for (int k = 0; k < childNodes.getLength(); k++) {
                //12.区分出text类型和element类型的node
                if (childNodes.item(k).getNodeType() == Node.ELEMENT_NODE) {

                    //13.获取element类型节点的节点名
                    System.out.print("第" + (k + 1) + "节点的节点名：" + childNodes.item(k).getNodeName() + "  ");

                    //14.获取element类型节点的节点值
                    System.out.println("节点值：" + childNodes.item(k).getTextContent());

                    if (childNodes.item(k).getNodeName().equals("sfzmhm")) {
                        sfzmhm = childNodes.item(k).getTextContent();
                    }

                }
            }
            if (isEmpty(sfzmhm)) {
                result = getFailXml("查询条件不能为空");
            } else {
                for (TrffWeb.DriverPhoto driverInfo : list2) {
                    if (driverInfo.name.equals(sfzmhm)) {
                        driverInfo.name = driverInfo.name;
                        driverInfo.zp = getPhoto(driverInfo.name);
                        list.add(driverInfo);
                    }
                }
                if (list.size() == 0) {
                    result = getFailXml("未查询到结果");
                } else {
                    mTrffWeb.setType(2);
                    result = getSuccessXml(list);
                }
            }
        }
        if (type == 3) {
            List<TrffWeb.DrivingLicence> list = new ArrayList<TrffWeb.DrivingLicence>();
            String sfzmhm = "";
            for (int k = 0; k < childNodes.getLength(); k++) {
                //12.区分出text类型和element类型的node
                if (childNodes.item(k).getNodeType() == Node.ELEMENT_NODE) {

                    //13.获取element类型节点的节点名
                    System.out.print("第" + (k + 1) + "节点的节点名：" + childNodes.item(k).getNodeName() + "  ");

                    //14.获取element类型节点的节点值
                    System.out.println("节点值：" + childNodes.item(k).getTextContent());

                    if (childNodes.item(k).getNodeName().equals("sfzmhm")) {
                        sfzmhm = childNodes.item(k).getTextContent();
                    }

                }
            }
            if (isEmpty(sfzmhm)) {
                result = getFailXml("查询条件不能为空");
            } else {
                for (TrffWeb.DrivingLicence driverInfo : list3) {
                    if (driverInfo.sfzmhm.equals(sfzmhm)) {
                        list.add(driverInfo);
                    }
                }
                if (list.size() == 0) {
                    result = getFailXml("未查询到结果");
                } else {
                    mTrffWeb.setType(3);
                    result = getSuccessXml(list);
                }
            }
        }
        if (type == 4) {
            List<TrffWeb.CarInfo> list = new ArrayList<TrffWeb.CarInfo>();
            String hpzl = "";
            String hphm = "";
            for (int k = 0; k < childNodes.getLength(); k++) {
                //12.区分出text类型和element类型的node
                if (childNodes.item(k).getNodeType() == Node.ELEMENT_NODE) {

                    //13.获取element类型节点的节点名
                    System.out.print("第" + (k + 1) + "节点的节点名：" + childNodes.item(k).getNodeName() + "  ");

                    //14.获取element类型节点的节点值
                    System.out.println("节点值：" + childNodes.item(k).getTextContent());

                    if (childNodes.item(k).getNodeName().equals("hpzl")) {
                        hpzl = childNodes.item(k).getTextContent();
                    }
                    if (childNodes.item(k).getNodeName().equals("hphm")) {
                        hphm = childNodes.item(k).getTextContent();
                    }

                }
            }
            if (isEmpty(hpzl) || isEmpty(hphm)) {
                result = getFailXml("查询条件不能为空");
            } else {
                for (TrffWeb.CarInfo driverInfo : list4) {
                    if (driverInfo.hpzl.equals(hpzl) && driverInfo.hphm.equals(hphm)) {
                        list.add(driverInfo);
                    }
                }
                if (list.size() == 0) {
                    result = getFailXml("未查询到结果");
                } else {
                    mTrffWeb.setType(4);
                    result = getSuccessXml(list);
                }
            }
        }
        if (type == 5) {
            List<TrffWeb.IllegalInfo> list = new ArrayList<TrffWeb.IllegalInfo>();
            String jdsbh = "";
            String wfbh = "";
            String jszh = "";
            String dabh = "";
            String jkbj = "";
            for (int k = 0; k < childNodes.getLength(); k++) {
                //12.区分出text类型和element类型的node
                if (childNodes.item(k).getNodeType() == Node.ELEMENT_NODE) {

                    //13.获取element类型节点的节点名
                    System.out.print("第" + (k + 1) + "节点的节点名：" + childNodes.item(k).getNodeName() + "  ");

                    //14.获取element类型节点的节点值
                    System.out.println("节点值：" + childNodes.item(k).getTextContent());

                    if (childNodes.item(k).getNodeName().equals("jdsbh")) {
                        jdsbh = childNodes.item(k).getTextContent();
                    }
                    if (childNodes.item(k).getNodeName().equals("wfbh")) {
                        jdsbh = childNodes.item(k).getTextContent();
                    }
                    if (childNodes.item(k).getNodeName().equals("jszh")) {
                        jdsbh = childNodes.item(k).getTextContent();
                    }
                    if (childNodes.item(k).getNodeName().equals("dabh")) {
                        jdsbh = childNodes.item(k).getTextContent();
                    }
                    if (childNodes.item(k).getNodeName().equals("jkbj")) {
                        jkbj = childNodes.item(k).getTextContent();
                    }
                }
            }
            if (isEmpty(jdsbh) || isEmpty(wfbh) || isEmpty(jszh) || isEmpty(dabh) || isEmpty(jkbj)) {
                result = getFailXml("查询条件不能为空");
            } else {
                if (jkbj.equals("0")) {
                    for (TrffWeb.IllegalInfo driverInfo : list5) {
                        if (driverInfo.jdsbh.equals(jdsbh) || driverInfo.wfbh.equals(wfbh) || driverInfo.jszh.equals(jszh)
                                || driverInfo.dabh.equals(dabh)) {
                            list.add(driverInfo);
                        }
                    }
                    if (list.size() == 0) {
                        result = getFailXml("未查询到结果");
                    } else {
                        mTrffWeb.setType(5);
                        result = getSuccessXml(list);
                    }
                } else {
                    result = getFailXml("缴款标记不是未缴");
                }
            }
        }
        if (type == 6) {
            List<TrffWeb.MonitoringInfo> list = new ArrayList<TrffWeb.MonitoringInfo>();
            String hpzl = "";
            String hphm = "";
            String xh = "";
            String clbj = "";
            for (int k = 0; k < childNodes.getLength(); k++) {
                //12.区分出text类型和element类型的node
                if (childNodes.item(k).getNodeType() == Node.ELEMENT_NODE) {

                    //13.获取element类型节点的节点名
                    System.out.print("第" + (k + 1) + "节点的节点名：" + childNodes.item(k).getNodeName() + "  ");

                    //14.获取element类型节点的节点值
                    System.out.println("节点值：" + childNodes.item(k).getTextContent());

                    if (childNodes.item(k).getNodeName().equals("hpzl")) {
                        hpzl = childNodes.item(k).getTextContent();
                    }
                    if (childNodes.item(k).getNodeName().equals("hphm")) {
                        hphm = childNodes.item(k).getTextContent();
                    }
                    if (childNodes.item(k).getNodeName().equals("xh")) {
                        xh = childNodes.item(k).getTextContent();
                    }
                    if (childNodes.item(k).getNodeName().equals("clbj")) {
                        clbj = childNodes.item(k).getTextContent();
                    }

                }
            }
            if (isEmpty(hpzl) || isEmpty(hphm) || isEmpty(xh) || isEmpty(clbj)) {
                result = getFailXml("查询条件不能为空");
            } else {
                if (clbj.equals("0")) {
                    if (isEmpty(hpzl) || isEmpty(hphm)) {
                        if (!isEmpty(xh)) {
                            for (TrffWeb.MonitoringInfo driverInfo : list6) {
                                if (driverInfo.xh.equals(xh)) {
                                    list.add(driverInfo);
                                }
                            }
                            if (list.size() == 0) {
                                result = getFailXml("未查询到结果");
                            } else {
                                mTrffWeb.setType(6);
                                mTrffWeb.setMonitoringInfos(list6);
                                result = getSuccessXml(mTrffWeb.getMonitoringInfos());
                            }
                        } else {
                            result = getFailXml("查询条件不能为空");
                        }
                    } else {
                        if (!isEmpty(xh)) {
                            for (TrffWeb.MonitoringInfo driverInfo : list6) {
                                if (driverInfo.xh.equals(xh) && driverInfo.hpzl.equals(hpzl) && driverInfo.hphm.equals(hphm)) {
                                    list.add(driverInfo);
                                }
                            }
                            if (list.size() == 0) {
                                result = getFailXml("未查询到结果");
                            } else {
                                mTrffWeb.setType(6);
                                result = getSuccessXml(list);
                            }
                        } else {
                            result = getFailXml("查询条件不能为空");
                        }
                    }
                } else {
                    result = getFailXml("处理标记不是未处理");
                }

            }
        }
        if (type == 7) {
            List<TrffWeb.MonitorPhoto> list = new ArrayList<TrffWeb.MonitorPhoto>();
            String xh = "";
            for (int k = 0; k < childNodes.getLength(); k++) {
                //12.区分出text类型和element类型的node
                if (childNodes.item(k).getNodeType() == Node.ELEMENT_NODE) {

                    //13.获取element类型节点的节点名
                    System.out.print("第" + (k + 1) + "节点的节点名：" + childNodes.item(k).getNodeName() + "  ");

                    //14.获取element类型节点的节点值
                    System.out.println("节点值：" + childNodes.item(k).getTextContent());

                    if (childNodes.item(k).getNodeName().equals("xh")) {
                        xh = childNodes.item(k).getTextContent();
                    }

                }
            }
            if (isEmpty(xh)) {
                result = getFailXml("查询条件不能为空");
            } else {
                for (TrffWeb.MonitorPhoto driverInfo : list7) {
                    if (driverInfo.xh.equals(xh)) {
                        list.add(driverInfo);
                    }
                }
                if (list.size() == 0) {
                    result = getFailXml("未查询到结果");
                } else {
                    mTrffWeb.setType(10);
                    result = getSuccessXml(list);
                }
            }
        }
        if (type == 8) {
            List<TrffWeb.LogInfo> list = new ArrayList<TrffWeb.LogInfo>();
            String xh = "";
            String jdsbh = "";
            String pzbh = "";
            for (int k = 0; k < childNodes.getLength(); k++) {
                //12.区分出text类型和element类型的node
                if (childNodes.item(k).getNodeType() == Node.ELEMENT_NODE) {

                    //13.获取element类型节点的节点名
                    System.out.print("第" + (k + 1) + "节点的节点名：" + childNodes.item(k).getNodeName() + "  ");

                    //14.获取element类型节点的节点值
                    System.out.println("节点值：" + childNodes.item(k).getTextContent());


                    if (childNodes.item(k).getNodeName().equals("xh")) {
                        xh = childNodes.item(k).getTextContent();
                    }
                    if (childNodes.item(k).getNodeName().equals("jdsbh")) {
                        jdsbh = childNodes.item(k).getTextContent();
                    }
                    if (childNodes.item(k).getNodeName().equals("pzbh")) {
                        pzbh = childNodes.item(k).getTextContent();
                    }

                }
            }
            if (isEmpty(xh) || isEmpty(jdsbh) || isEmpty(pzbh)) {
                result = getFailXml("查询条件不能为空");
            } else {
                for (TrffWeb.LogInfo driverInfo : list8) {
                    if (driverInfo.xh.equals(xh) || driverInfo.jdsbh.equals(jdsbh) || driverInfo.pzbh.equals(pzbh)) {
                        list.add(driverInfo);
                    }
                }
                if (list.size() == 0) {
                    result = getFailXml("未查询到结果");
                } else {
                    mTrffWeb.setType(12);
                    result = getSuccessXml(list);
                }
            }
        }
        if (type == 9) {
            List<TrffWeb.AccountCheck> list = new ArrayList<TrffWeb.AccountCheck>();
            String jdsbh = "";
            for (int k = 0; k < childNodes.getLength(); k++) {
                //12.区分出text类型和element类型的node
                if (childNodes.item(k).getNodeType() == Node.ELEMENT_NODE) {

                    //13.获取element类型节点的节点名
                    System.out.print("第" + (k + 1) + "节点的节点名：" + childNodes.item(k).getNodeName() + "  ");

                    //14.获取element类型节点的节点值
                    System.out.println("节点值：" + childNodes.item(k).getTextContent());

                    if (childNodes.item(k).getNodeName().equals("jdsbh")) {
                        jdsbh = childNodes.item(k).getTextContent();
                    }
                }
            }
            if (isEmpty(jdsbh)) {
                result = getFailXml("查询条件不能为空");
            } else {
                for (TrffWeb.AccountCheck driverInfo : list9) {
                    if (driverInfo.jdsbh.equals(jdsbh)) {
                        list.add(driverInfo);
                    }
                }
                if (list.size() == 0) {
                    result = getFailXml("未查询到结果");
                } else {
                    mTrffWeb.setType(13);
                    mTrffWeb.setAccountCheck(list9);
                    result = getSuccessXml(mTrffWeb.getAccountCheck());
                }
            }
        }
        if (type == 10) {
            List<TrffWeb.CheckDriver> list = new ArrayList<TrffWeb.CheckDriver>();
            String jszh = "";
            String xm = "";
            String hpzl = "";
            String hphm = "";
            for (int k = 0; k < childNodes.getLength(); k++) {
                //12.区分出text类型和element类型的node
                if (childNodes.item(k).getNodeType() == Node.ELEMENT_NODE) {

                    //13.获取element类型节点的节点名
                    System.out.print("第" + (k + 1) + "节点的节点名：" + childNodes.item(k).getNodeName() + "  ");

                    //14.获取element类型节点的节点值
                    System.out.println("节点值：" + childNodes.item(k).getTextContent());

                    if (childNodes.item(k).getNodeName().equals("jszh")) {
                        jszh = childNodes.item(k).getTextContent();
                    }
                    if (childNodes.item(k).getNodeName().equals("xm")) {
                        xm = childNodes.item(k).getTextContent();
                    }
                    if (childNodes.item(k).getNodeName().equals("hpzl")) {
                        hpzl = childNodes.item(k).getTextContent();
                    }
                    if (childNodes.item(k).getNodeName().equals("hphm")) {
                        hphm = childNodes.item(k).getTextContent();
                    }

                }
            }
            if (isEmpty(jszh) || isEmpty(xm) || isEmpty(hpzl) || isEmpty(hphm)) {
                result = getFailXml("查询条件不能为空");
            } else {
                for (TrffWeb.CheckDriver driverInfo : list10) {
                    if (driverInfo.jszh.equals(jszh) && driverInfo.xm.equals(xm) && driverInfo.hpzl.equals(hpzl) &&
                            driverInfo.hphm.equals(hphm)) {
                        list.add(driverInfo);
                    }
                }
                if (list.size() == 0) {
                    result = getFailXml("未查询到结果");
                } else {
                    mTrffWeb.setType(14);
                    mTrffWeb.setCheckDrivers(list10);
                    result = getSuccessXmlCheckDriver();
                }
            }
        }
        if (type == 11) {
            List<TrffWeb.DriverInfo> list = new ArrayList<TrffWeb.DriverInfo>();
            String sfzmhm = "";
            for (int k = 0; k < childNodes.getLength(); k++) {
                //12.区分出text类型和element类型的node
                if (childNodes.item(k).getNodeType() == Node.ELEMENT_NODE) {

                    //13.获取element类型节点的节点名
                    System.out.print("第" + (k + 1) + "节点的节点名：" + childNodes.item(k).getNodeName() + "  ");

                    //14.获取element类型节点的节点值
                    System.out.println("节点值：" + childNodes.item(k).getTextContent());

                    if (childNodes.item(k).getNodeName().equals("sfzmhm")) {
                        sfzmhm = childNodes.item(k).getTextContent();
                    }

                }
            }
            if (isEmpty(sfzmhm)) {
                result = getFailXml("查询条件不能为空");
            } else {
                for (TrffWeb.DriverInfo driverInfo : list1) {
                    if (driverInfo.sfzmhm.equals(sfzmhm)) {
                        list.add(driverInfo);
                    }
                }
                if (list.size() == 0) {
                    result = getFailXml("未查询到结果");
                } else {
                    mTrffWeb.setType(15);
                    mTrffWeb.setIllegalCodes(list11);
                    result = getSuccessXml(mTrffWeb.getIllegalCodes());
                }
            }
        }
        return result;
    }


    @WebMethod
    public String writeObjectOut(String xtlb, String jkxlh, String jkid, String WriteXmlDoc) {
        String result = "";
        if (jkid.equals("04C56") || jkid.equals("04C51") || jkid.equals("04C61")) {
            result = writeSuccessXml();
        } else {
            result = writeFailXml();
        }

        System.out.print(result);

        return result;
    }

    private String getSuccessXmlCheckDriver() {
        StringBuffer buffer = new StringBuffer();
        buffer.append(getXMLFileHead());
        buffer.append(getXMLHead());
        buffer.append("<code>2</code>");
        buffer.append("<msg>2018-09-10 11:11:11</msg>");
        buffer.append(getXMLFoot());
        buffer.append(getXMLFileFoot());
        return buffer.toString();
    }

    private String getFailXmlCheckDriver() {
        StringBuffer buffer = new StringBuffer();
        buffer.append(getXMLFileHead());
        buffer.append(getXMLHead());
        buffer.append("<code>0</code>");
        buffer.append("<msg>无法处理,表示非车主且为重点人员或无备案信息</msg>");
        buffer.append(getXMLFoot());
        buffer.append(getXMLFileFoot());
        return buffer.toString();
    }

    private String writeSuccessXml() {
        StringBuffer buffer = new StringBuffer();
        buffer.append(getXMLFileHead());
        buffer.append(getXMLHead());
        buffer.append("<code>1</code>");
        buffer.append("<message>数据保存成功</message>");
        buffer.append(getXMLFoot());
        buffer.append(getXMLFileFoot());
        return buffer.toString();
    }

    private String writeFailXml() {
        StringBuffer buffer = new StringBuffer();
        buffer.append(getXMLFileHead());
        buffer.append(getXMLHead());
        buffer.append("<code>0</code>");
        buffer.append("<message>数据保存失败</message>");
        buffer.append(getXMLFoot());
        buffer.append(getXMLFileFoot());
        return buffer.toString();
    }

    private String getSuccessXml(List result) {
        String itemName = "";
        if (result.get(0).getClass().getSimpleName().equals("DrivingLicence")) {
            itemName = "DrvPerson";
        } else if (result.get(0).getClass().getSimpleName().equals("DriverInfo")) {
            itemName = "drv";
        } else if (result.get(0).getClass().getSimpleName().equals("CarInfo")) {
            itemName = "veh";
        } else if (result.get(0).getClass().getSimpleName().equals("IllegalInfo")) {
            itemName = "violation";
        } else if (result.get(0).getClass().getSimpleName().equals("MonitoringInfo")) {
            itemName = "viosurveil";
        } else if (result.get(0).getClass().getSimpleName().equals("DriverPhoto")) {
            itemName = "DrvZp";
        } else if (result.get(0).getClass().getSimpleName().equals("MonitorPhoto")) {
            itemName = "viojdczp";
        } else if (result.get(0).getClass().getSimpleName().equals("LogInfo")) {
            itemName = "vio";
        } else if (result.get(0).getClass().getSimpleName().equals("AccountCheck")) {
            itemName = "vio";
        } else if (result.get(0).getClass().getSimpleName().equals("IllegalCode")) {
            itemName = "codewfdm";
        } else if (result.get(0).getClass().getSimpleName().equals("CheckDriver")) {
            itemName = "vio";
        }

        StringBuffer buffer = new StringBuffer();
        buffer.append(getXMLFileHead());
        buffer.append(getSuccessHead(result.size()));
        buffer.append(getXMLBodyHead());
        for (int i = 0; i < result.size(); i++) {
            try {
                String itemId = "\"" + i + "\"";
                buffer.append(bean2XMLUTF8(result.get(i), itemName, itemId));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        buffer.append(getXMLBodyFoot());
        buffer.append(getXMLFileFoot());
        return buffer.toString();
    }

    private String getFailXml(String result) {
        StringBuffer buffer = new StringBuffer();
        buffer.append(getXMLFileHead());
        buffer.append(getFailHead(result));
        buffer.append(getXMLFileFoot());
        return buffer.toString();
    }

    @SuppressWarnings("rawtypes")
    private static String bean2XMLUTF8(Object bean, String itemName, String itemId) throws Exception {
        StringBuffer buffer = new StringBuffer();
        Map p = obj2Map(bean);
        Set s = p.keySet();
        Iterator i = s.iterator();
        buffer.append("<");
        buffer.append(itemName);
        if (itemName == null || itemName.equals("")) {
            buffer.append(">");
        } else {
            buffer.append(" id=");
            buffer.append(itemId);
            buffer.append(">");
        }
        while (i.hasNext()) {
            Object key = i.next();
            if (key.equals("class")) {
            } else {
                Object value = p.get(key);
                buffer.append("  <");
                buffer.append(key);
                buffer.append(">");
                if (value == null || value.toString().equals("")) {
                    buffer.append("");
                } else {
                    //value = URLEncoder.encode(value.toString(), "utf-8");
                    buffer.append(value);
                }
                buffer.append("</");
                buffer.append(key);
                buffer.append(">");
            }

        }
        buffer.append("</");
        buffer.append(itemName);
        buffer.append(">");
        return buffer.toString();
    }

    private static Map<String, String> obj2Map(Object obj) {

        Map<String, String> map = new HashMap<String, String>();
        // System.out.println(obj.getClass());
        // 获取f对象对应类中的所有属性域
        Field[] fields = obj.getClass().getDeclaredFields();
        for (int i = 0, len = fields.length; i < len; i++) {
            String varName = fields[i].getName();
            varName = varName.toLowerCase();//将key置为小写，默认为对象的属性
            try {
                // 获取原来的访问控制权限
                boolean accessFlag = fields[i].isAccessible();
                // 修改访问控制权限
                fields[i].setAccessible(true);
                // 获取在对象f中属性fields[i]对应的对象中的变量
                Object o = fields[i].get(obj);
                if (o != null)
                    map.put(varName, o.toString());
                System.out.println("传入的对象中包含一个如下的变量：" + varName + " = " + o);
                // 恢复访问控制权限
                fields[i].setAccessible(accessFlag);
            } catch (IllegalArgumentException ex) {
                ex.printStackTrace();
            } catch (IllegalAccessException ex) {
                ex.printStackTrace();
            }
        }
        return map;
    }


    private static String getXMLFileHead() {
        return "<?xml version=\"1.0\" encoding=\"GBK\"?>\n<root>\n";
    }

    private static String getXMLFileFoot() {
        return "</root>";
    }

    private static String getXMLBodyHead() {
        return "<body>";
    }

    private static String getXMLBodyFoot() {
        return "</body>";
    }

    private static String getXMLHead() {
        return "<head>";
    }

    private static String getXMLFoot() {
        return "</head>";
    }

    private String getSuccessHead(int size) {
        StringBuffer buffer = new StringBuffer();
        buffer.append(getXMLHead());
        buffer.append("<code>1</code>");
        buffer.append("<message>数据下载成功</message>");
        buffer.append("<rownum>" + size + "</rownum>");
        buffer.append(getXMLFoot());
        return buffer.toString();
    }


    private String getFailHead(String message) {
        StringBuffer buffer = new StringBuffer();
        buffer.append(getXMLHead());
        buffer.append("<code>1</code>");
        buffer.append("<message>" + message + "</message>");
        buffer.append(getXMLFoot());
        return buffer.toString();
    }

    private static String getPhoto(String name) {
        //URL url = Test.class.getResource();
        String tempPath = TmriOutAccess.class.getResource("/").getPath();    // 获取了工程中的classes目录(该目录位于webinf下面)
        String webinfPath = tempPath.substring(0, tempPath.lastIndexOf("classes")); // 取得webinf的路径
        //URL url = TmriOutAccess.class.getClassLoader().getResource("downloadTestImg.jpg");
        //URL url = TmriOutAccess.class.getClassLoader().getResource("downloadTestImg.jpg");
        System.out.print("file:" + webinfPath);
        //URL url = TmriOutAccess.class.getClass().getResource("downloadTestImg.jpg");
        File file = new File(webinfPath, name + ".jpg");
        System.out.print("file:" + file.getAbsolutePath());
        Logger logger = Logger.getLogger("TmriOutAccess");
        logger.info("webinfPath：" + webinfPath);
        if (file.exists()) {
            String str =getImageStr(file.getAbsolutePath());
            System.out.print("getImageStr:" + str);
            //return "data:image/jpeg;base64,"+getImageStr(file.getAbsolutePath());
            return str;
        } else {
            return "";
        }
    }


    /**
     * @return
     * @Description: 根据图片地址转换为base64编码字符串
     * @Author:
     * @CreateTime:
     */
    private static String getImageStr(String imgFile) {
        InputStream inputStream = null;
        byte[] data = null;
        try {
            inputStream = new FileInputStream(imgFile);
            data = new byte[inputStream.available()];
            inputStream.read(data);
            inputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        // 加密
        BASE64Encoder encoder = new BASE64Encoder();
        return encoder.encode(data).replace(" ", "+");
    }

    //图片转化成base64字符串
    public static String GetImageStr(String imageName)
    {//将图片文件转化为字节数组字符串，并对其进行Base64编码处理
        String imgFile = imageName;//待处理的图片
        InputStream in = null;
        byte[] data = null;
        //读取图片字节数组
        try
        {
            in = new FileInputStream(imgFile);
            data = new byte[in.available()];
            in.read(data);
            in.close();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        //对字节数组Base64编码
        BASE64Encoder encoder = new BASE64Encoder();
        return encoder.encode(data);//返回Base64编码过的字节数组字符串
    }


    public TmriOutAccess() {
        initDataDriverInfo();
        initDataDriverPhoto();
        initDataDrivingLicence();
        initDataCarInfo();
        initDataIllegalInfo();
        initDataMonitoringInfo();
        initDataMonitorPhoto();
        initDataLogInfo();
        initDataAccountCheck();
        initDataCheckDriver();
        initDataIllegalCode();
    }

    private void initDataDriverInfo() {
        for (int i = 0; i < 5; i++) {
            TrffWeb.DriverInfo driverInfo = new TrffWeb.DriverInfo();
            if (i == 0) {
                //身份证明名称
                driverInfo.sfzmhm = "421003198810151013";
                //姓名
                driverInfo.xm = "王杰";
            } else if (i == 1) {
                //身份证明名称
                driverInfo.sfzmhm = "421003197810111018";
                //姓名
                driverInfo.xm = "范伟";
            } else if (i == 2) {
                //身份证明名称
                driverInfo.sfzmhm = "421003196810251112";
                //姓名
                driverInfo.xm = "葛优";
            } else if (i == 3) {
                //身份证明名称
                driverInfo.sfzmhm = "421003197301151011";
                //姓名
                driverInfo.xm = "成龙";
            } else if (i == 4) {
                //身份证明名称
                driverInfo.sfzmhm = "421003199009151015";
                //姓名
                driverInfo.xm = "刘德华";
            }

            //身份证明号码
            driverInfo.sfzmmc = "s";

            //号码长度标志
            driverInfo.hmcd = "2";

            //性别
            driverInfo.xb = "M";

            //出生日期
            driverInfo.csrq = "1988-08-08";

            //国籍
            driverInfo.gj = "中国";

            //登记住所行政区划
            driverInfo.djzsxzqh = "湖北";

            //登记住所详细地址
            driverInfo.djzsxxdz = "武汉市江夏区";

            //联系住所行政区划
            driverInfo.lxzsxzqh = "湖北";

            //联系住所详细地址
            driverInfo.lxzsxxdz = "武汉市江夏区";

            //邮政编码
            driverInfo.lxzsyzbm = "430000";

            //联系电话
            driverInfo.lxdh = "13888888888";

            //暂住证
            driverInfo.zzzm = "123456654321123456";

            //更新时间
            driverInfo.gxsj = "2018-08-08";

            //是否本地 1本地0外地
            driverInfo.sfbd = "1";

            //手机号码
            driverInfo.sjhm = "13888888888";

            //电子邮箱
            driverInfo.dzyx = "123456@qq.com";

            list1.add(driverInfo);
        }
    }

    private void initDataDriverPhoto() {
        for (int i = 0; i < 5; i++) {
            TrffWeb.DriverPhoto photo = new TrffWeb.DriverPhoto();
            //照片 Base64编码的字符串
            if (i == 0) {
                photo.name = "421003198810151013";
            } else if (i == 1) {
                photo.name = "421003197810111018";
            } else if (i == 2) {
                photo.name = "421003196810251112";
            } else if (i == 3) {
                photo.name = "421003197301151011";
            } else if (i == 4) {
                photo.name = "421003199009151015";
            }
            photo.zp = photo.name;
            list2.add(photo);
        }
    }

    private void initDataDrivingLicence() {
        try {
            for (int i = 0; i < 5; i++) {
                TrffWeb.DrivingLicence drivingLicence = new TrffWeb.DrivingLicence();

                if (i == 0) {
                    //身份证明名称
                    drivingLicence.sfzmhm = "421003198810151013";

                } else if (i == 1) {
                    //身份证明名称
                    drivingLicence.sfzmhm = "421003197810111018";

                } else if (i == 2) {
                    //身份证明名称
                    drivingLicence.sfzmhm = "421003196810251112";

                } else if (i == 3) {
                    //身份证明名称
                    drivingLicence.sfzmhm = "421003197301151011";

                } else if (i == 4) {
                    //身份证明名称
                    drivingLicence.sfzmhm = "421003199009151015";

                }

                //身份证明名称
                drivingLicence.sfzmmc = "s";

                //号码长度标志
                drivingLicence.hmcd = "2";

                //姓名
                drivingLicence.xm = "ramos";

                //性别
                drivingLicence.xb = "M";

                //出生日期

                drivingLicence.csrq = new SimpleDateFormat("yyyy-MM-dd").parse("2018-08-08");


                //国籍
                drivingLicence.gj = "中国";

                //登记住所行政区划
                drivingLicence.djzsxzqh = "湖北";

                //登记住所详细地址
                drivingLicence.djzsxxdz = "武汉市江夏区";

                //联系住所行政区划
                drivingLicence.lxzsxzqh = "湖北";

                //联系住所详细地址
                drivingLicence.lxzsxxdz = "武汉市江夏区";

                //邮政编码
                drivingLicence.lxzsyzbm = "430000";

                //联系电话
                drivingLicence.lxdh = "13888888888";

                //手机号码
                drivingLicence.sjhm = "13888888888";


                //电子邮箱
                drivingLicence.dzyx = "123456@qq.com";

                //档案编号
                drivingLicence.dabh = "123456654321";

                //准驾车型
                drivingLicence.zjcx = "C1";

                //累积记分
                drivingLicence.ljjf = 6;

                //状态
                drivingLicence.zt = "有效";

                //初次领证日期
                drivingLicence.cclzrq = new SimpleDateFormat("yyyy-MM-dd").parse("2018-08-08");

                //驾证期限
                drivingLicence.jzqx = "2020-08-08";

                //下一体检日期
                drivingLicence.syrq = new SimpleDateFormat("yyyy-MM-dd").parse("2018-08-08");

                //有效期始
                drivingLicence.yxqs = new SimpleDateFormat("yyyy-MM-dd").parse("2018-08-08");

                //有效期止
                drivingLicence.yxqz = new SimpleDateFormat("yyyy-MM-dd").parse("2018-08-08");

                //行政区划
                drivingLicence.xzqh = "湖北";

                //暂住证
                drivingLicence.zzzm = "122311222";

                //更新时间
                drivingLicence.gxsj = new SimpleDateFormat("yyyy-MM-dd").parse("2018-08-08");

                //证芯编号
                drivingLicence.zxbh = "11221132111";

                drivingLicence.fzjg = "武汉市公安局";
                list3.add(drivingLicence);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    private void initDataCarInfo() {
        try {
            for (int i = 0; i < 5; i++) {
                TrffWeb.CarInfo carInfo = new TrffWeb.CarInfo();

                if (i == 0) {
                    //号牌号码
                    carInfo.hphm = "粤A88880";

                } else if (i == 1) {
                    //号牌号码
                    carInfo.hphm = "粤A88881";

                } else if (i == 2) {
                    //号牌号码
                    carInfo.hphm = "粤A88882";

                } else if (i == 3) {
                    //号牌号码
                    carInfo.hphm = "粤A88889";

                } else if (i == 4) {
                    //号牌号码
                    carInfo.hphm = "粤A88888";

                }


                //机动车序号
                carInfo.xh = "" + System.currentTimeMillis();

                //号牌种类
                carInfo.hpzl = "02";

                //号牌号码
                //carInfo.hphm = "粤A88888";

                //中文品牌
                carInfo.clpp1 = "奔驰";

                //车辆型号
                carInfo.clxh = "S600";

                //英文品牌
                carInfo.clpp2 = "Benz";

                //国产/进口
                carInfo.gcjk = "2";

                //制造国
                carInfo.zzg = "德国";

                //制造厂名称
                carInfo.zzcmc = "德国奔驰";

                //车辆识别代号
                carInfo.clsbdh = "WDB2231321323123";

                //发动机号
                carInfo.fdjh = "21232345131234124";

                //车辆类型
                carInfo.cllx = "轿车";

                //车身颜色
                carInfo.csys = "褐色";

                //使用性质
                carInfo.syxz = "自用";

                //身份证明号码
                carInfo.sfzmhm = "421003199910151014";

                //身份证明名称
                carInfo.sfzmmc = "2";

                //机动车所有人
                carInfo.syr = "王杰";

                //初次登记日期
                carInfo.ccdjrq = "2018-08-08";

                //最近定检日期
                carInfo.djrq = "2018-08-08";

                //检验有效期止
                carInfo.yxqz = "2020-08-08";

                //强制报废期止
                carInfo.qzbfqz = "2030-08-08";

                //发证机关
                carInfo.fzjg = "广州市车管所";

                //管理部门
                carInfo.glbm = "广州市车管所";

                //保险终止日期
                carInfo.bxzzrq = "2020-08-08";

                //机动车状态
                carInfo.zt = "有效";

                //抵押标记
                carInfo.dybj = "0";

                //发动机型号
                carInfo.fdjxh = "8V100";

                //燃料种类
                carInfo.rlzl = "汽油";

                //排量
                carInfo.pl = "3.0";

                //功率
                carInfo.gl = "6.0";

                //转向形式
                carInfo.zxxs = "1";

                //车外廓长
                carInfo.cwkc = "5.0";

                //车外廓宽
                carInfo.cwkk = "4.0";

                //车外廓高
                carInfo.cwkg = "4.0";

                //货箱内部长度
                carInfo.hxnbcd = "5.0";

                //货箱内部宽度
                carInfo.hxnbkd = "4。0";

                //货箱内部高度
                carInfo.hxnbgd = "4.0";

                //钢板弹簧片数
                carInfo.gbthps = "3";

                //轴数
                carInfo.zs = "1";

                //轴距
                carInfo.zj = "5.0";

                //前轮距
                carInfo.qlj = "4.0";

                //后轮距
                carInfo.hlj = "4.0";

                //轮胎规格
                carInfo.ltgg = "64";

                //轮胎数
                carInfo.lts = "4";

                //总质量
                carInfo.zzl = "8.0";

                //整备质量
                carInfo.zbzl = "8.0";

                //核定载质量
                carInfo.hdzzl = "8.0";

                //核定载客
                carInfo.hdzk = "5";

                //准牵引总质量
                carInfo.zqyzl = "8.0";

                //驾驶室前排载客人数
                carInfo.qpzk = "1";

                //驾驶室后排载客人数
                carInfo.hpzk = "2";

                //环保达标情况
                carInfo.hbdbqk = "国5";

                //出厂日期
                carInfo.ccrq = "2018-08-08";

                //车辆用途
                carInfo.clyt = "自用";

                //用途属性
                carInfo.ytsx = "1";

                //行驶证证芯编号
                carInfo.xszbh = "31242141341412412";

                //检验合格标志
                carInfo.jyhgbzbh = "合格";

                //住所详细地址
                carInfo.zzxxdz = "广州市花都";

                //手机号码
                carInfo.sjhm = "138888888888";

                //联系电话
                carInfo.lxdh = "138888888888";

                list4.add(carInfo);

            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void initDataIllegalInfo() {
        try {
            for (int i = 0; i < 5; i++) {
                TrffWeb.IllegalInfo illegalInfo = new TrffWeb.IllegalInfo();

                if (i == 0) {
                    //驾驶证号
                    illegalInfo.jszh = "421003198810151013";

                } else if (i == 1) {
                    //驾驶证号
                    illegalInfo.jszh = "421003197810111018";

                } else if (i == 2) {
                    //驾驶证号
                    illegalInfo.jszh = "421003196810251112";

                } else if (i == 3) {
                    //驾驶证号
                    illegalInfo.jszh = "421003197301151011";

                } else if (i == 4) {
                    //驾驶证号
                    illegalInfo.jszh = "421003199009151015";

                }

                //违法编号
                illegalInfo.wfbh = "" + System.currentTimeMillis();

                //决定书类别
                illegalInfo.jdslb = "2";

                //决定书编号
                illegalInfo.jdsbh = "124678331122";

                //文书校验位
                illegalInfo.wsjyw = "1";

                //人员分类
                illegalInfo.ryfl = "2";

                //驾驶证号
                //illegalInfo.jszh = "421003199910151014";

                //档案编号
                illegalInfo.dabh = "45678998765445";

                //发证机关
                illegalInfo.fzjg = "广州市公安局";

                //准驾车型
                illegalInfo.zjcx = "C1";

                //当事人
                illegalInfo.dsr = "王伟";

                //住所行政区划
                illegalInfo.zsxzqh = "广东省广州市";

                //住所详细地址
                illegalInfo.zsxxdz = "花都区白云机场";

                //电话
                illegalInfo.dh = "138888888888";

                //联系方式
                illegalInfo.lxfs = "138888888888";

                //车辆分类
                illegalInfo.clfl = "2";

                //号牌种类
                illegalInfo.hpzl = "12";

                //号牌号码
                illegalInfo.hphm = "粤A88888";

                //机动车所有人
                illegalInfo.jdcsyr = "王杰";

                //机动车使用性质
                illegalInfo.syxz = "自用";

                //交通方式
                illegalInfo.jtfs = "汽车";

                //违法时间
                illegalInfo.wfsj = "2018-08-08";

                //违法地点
                illegalInfo.wfdd = "广州市白云机场";

                //违法地址
                illegalInfo.wfdz = "广州市白云机场";

                //违法行为
                illegalInfo.wfxw = "闯红灯";

                //违法记分数
                illegalInfo.wfjfs = "6";

                //罚款金额
                illegalInfo.fkje = "300";

                //实测值
                illegalInfo.scz = "30";

                //标准值
                illegalInfo.bzz = "20";

                //滞纳金
                illegalInfo.znj = "600";

                //执勤民警
                illegalInfo.zqmj = "王伟";

                //交款方式
                illegalInfo.jkfs = "现金";

                //发现机关
                illegalInfo.fxjg = "高新派出所";

                //发现机关名称
                illegalInfo.fxjgmc = "高新派出所";

                //处理机关
                illegalInfo.cljg = "高新派出所";

                //处理机关名称
                illegalInfo.cljgmc = "高新派出所";

                //处罚种类
                illegalInfo.cfzl = "记分罚款";

                //处理时间
                illegalInfo.clsj = "2018-08-08";

                //交款标记
                illegalInfo.jkbj = "1";

                //交款日期
                illegalInfo.jkrq = "2018-08-08";

                //强制措施凭证号
                illegalInfo.pzbh = "23dqewqeqwe211";

                //拒收拒签标记
                illegalInfo.jsjqbj = "13";

                //记录类型
                illegalInfo.jllx = "2";

                //录入人
                illegalInfo.lrr = "范伟";

                //录入时间
                illegalInfo.lrsj = "2018-08-08";

                //经办人1
                illegalInfo.jbr1 = "范伟";

                //经办人2
                illegalInfo.jbr2 = "范伟";

                //事故等级
                illegalInfo.sgdj = "A";

                //信息来源 1-现场处罚，2-非现场处罚
                illegalInfo.xxly = "1";

                //写入模式 1-系统写入;2-接口写入
                illegalInfo.xrms = "1";

                //接受机关
                illegalInfo.jsjg = "高新派出所";

                //发送机关
                illegalInfo.fsjg = "高新派出所";

                //更新时间
                illegalInfo.gxsj = "2018-08-08";

                //备注
                illegalInfo.bz = "无";

                //应收滞纳金
                illegalInfo.ysznj = "600";

                //list.add(illegalInfo);
                list5.add(illegalInfo);

            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void initDataMonitoringInfo() {
        try {
            for (int i = 0; i < 5; i++) {
                TrffWeb.MonitoringInfo monitoringInfo = new TrffWeb.MonitoringInfo();

                if (i == 0) {
                    //号牌号码
                    monitoringInfo.hphm = "粤A88880";

                } else if (i == 1) {
                    //号牌号码
                    monitoringInfo.hphm = "粤A88881";

                } else if (i == 2) {
                    //号牌号码
                    monitoringInfo.hphm = "粤A88882";

                } else if (i == 3) {
                    //号牌号码
                    monitoringInfo.hphm = "粤A88889";

                } else if (i == 4) {
                    //号牌号码
                    monitoringInfo.hphm = "粤A88888";

                }


                //序号
                monitoringInfo.xh = "" + System.currentTimeMillis();

                //违法采集机关
                monitoringInfo.cjjg = "广州市公安局";

                //采集机关名称
                monitoringInfo.cjjgmc = "广州市公安局";

                //车辆分类
                monitoringInfo.clfl = "2";

                //号牌种类
                monitoringInfo.hpzl = "02";

                //号牌号码
                //monitoringInfo.hphm = "粤A88888";

                //机动车所有人
                monitoringInfo.jdcsyr = "范伟";

                //机动车使用性质
                monitoringInfo.syxz = "家用";

                //发动机号
                monitoringInfo.fdjh = "21232345131234124";

                //车辆识别代号
                monitoringInfo.clsbdh = "21232345131234124";

                //车身颜色
                monitoringInfo.csys = "黑色";

                //车辆品牌
                monitoringInfo.clpp = "奔驰";

                //交通方式
                monitoringInfo.jtfs = "汽车";

                //发证机关
                monitoringInfo.fzjg = "广州市公安局";

                //住所行政区划
                monitoringInfo.zsxzqh = "广州市白云机场";

                //住所详细地址
                monitoringInfo.zsxxdz = "广州市白云机场";

                //电话
                monitoringInfo.dh = "13888888888";

                //联系方式
                monitoringInfo.lxfs = "13888888888";

                //通知书号
                monitoringInfo.tzsh = "12345678901234";

                //通知标记 0-未通知，1-已通知，2-无需通知
                monitoringInfo.tzbj = "0";

                //通知日期
                monitoringInfo.tzrq = "2018-08-08";

                //采集方式
                monitoringInfo.cjfs = "1";

                //违法时间
                monitoringInfo.wfsj = "2018-08-08";

                //违法地点
                monitoringInfo.wfdd = "2018-08-08";

                //违法地址
                monitoringInfo.wfdz = "广州市白云机场";

                //违法行为
                monitoringInfo.wfxw = "闯红灯";

                //罚款金额
                monitoringInfo.fkje = "300";

                //实测值
                monitoringInfo.scz = "60";

                //标准值
                monitoringInfo.bzz = "50";

                //执勤民警
                monitoringInfo.zqmj = "范伟";

                //处理机关
                monitoringInfo.cljg = "高新派出所";

                //处理机关名称
                monitoringInfo.cljgmc = "高新派出所";

                //处理时间
                monitoringInfo.clsj = "2018-08-08";

                //处理标记
                monitoringInfo.clbj = "1";

                //交款方式
                monitoringInfo.jkfs = "现金";

                monitoringInfo.jkbj = "111";

                //缴款日期
                monitoringInfo.jkrq = "2018-08-08";

                //强制措施凭证号
                monitoringInfo.pzbh = "123456789012345";

                //违法编号
                monitoringInfo.wfbh = "123456789012345678901";

                //决定书号
                monitoringInfo.jdsbh = "123456789012345";

                //决定书号校验位
                monitoringInfo.wsjyw = "1";

                //决定书类别
                monitoringInfo.jdslb = "1";

                //当事人
                monitoringInfo.dsr = "范伟";

                //经办人
                monitoringInfo.jbr = "范伟";

                //录入人
                monitoringInfo.lrr = "范伟";

                //录入时间
                monitoringInfo.lrsj = "2018-08-08";

                //记录类型
                monitoringInfo.jllx = "1";

                //处理对象标记 0-本地;1-本省外地市;2-外省
                monitoringInfo.cldxbj = "范伟";

                //写入模式 1-系统采集;2-接口写入
                monitoringInfo.xrms = "2";

                //接受机关
                monitoringInfo.jsjg = "高新派出所";

                //发送机关
                monitoringInfo.fsjg = "高新派出所";

                //更新时间
                monitoringInfo.gxsj = "2018-08-08";

                //备注
                monitoringInfo.bz = "无";

                // list.add(monitoringInfo);
                list6.add(monitoringInfo);

            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void initDataMonitorPhoto() {
        try {
            for (int i = 0; i < 5; i++) {
                TrffWeb.MonitorPhoto photo = new TrffWeb.MonitorPhoto();

                if (i == 0) {
                    //序号
                    photo.xh = "421003198810151013";

                } else if (i == 1) {
                    //序号
                    photo.xh = "421003197810111018";

                } else if (i == 2) {
                    //序号
                    photo.xh = "421003196810251112";

                } else if (i == 3) {
                    //序号
                    photo.xh = "421003197301151011";

                } else if (i == 4) {
                    //序号
                    photo.xh = "421003199009151015";

                }

                //序号
                //photo.xh = "" + System.currentTimeMillis();
                //号牌种类
                photo.hpzl = "3";
                //号牌号码
                photo.hphm = "粤A88888";
                //录入时间
                photo.lrsj = "2018-08-08";
                //记录类型
                photo.jllx = "1";
                //照片1 Base64编码
                photo.zpstr1 = getPhoto("421003198810151013");
                //照片2 Base64编码
                photo.zpstr2 = getPhoto("421003197810111018");
                //照片3 Base64编码
                photo.zpstr3 = getPhoto("421003196810251112");

                list7.add(photo);

            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void initDataLogInfo() {
        try {
            for (int i = 0; i < 5; i++) {
                TrffWeb.LogInfo logInfo = new TrffWeb.LogInfo();

                if (i == 0) {
                    //序号
                    logInfo.xh = "421003198810151013";

                } else if (i == 1) {
                    //序号
                    logInfo.xh = "421003197810111018";

                } else if (i == 2) {
                    //序号
                    logInfo.xh = "421003196810251112";

                } else if (i == 3) {
                    //序号
                    logInfo.xh = "421003197301151011";

                } else if (i == 4) {
                    //序号
                    logInfo.xh = "421003199009151015";
                }

                //管理部门
                logInfo.glbm = "公安局";
                //用户代号
                logInfo.yhdh = "12345678901234";
                //经办人
                logInfo.jbr = "王杰";
                //操作时间
                logInfo.czsj = "2018-08-08";
                //菜单编号
                logInfo.cdbh = "12";
                //功能ID
                logInfo.gnid = "13";
                //操作内容
                logInfo.cznr = "2018年8月8日因闯红灯违法";
                //决定书编号
                logInfo.jdsbh = "1234567890";
                //凭证编号
                logInfo.pzbh = "1234567890";
                //序号
                //logInfo.xh = "1234567890";
                //驾驶证号
                logInfo.jszh = "12345678901234";
                //档案编号
                logInfo.dabh = "" + System.currentTimeMillis();
                //号牌种类
                logInfo.hpzl = "12";
                //号牌号码
                logInfo.hphm = "粤A88888";
                //ip地址
                logInfo.ip = "192.168.1.1";
                //备注
                logInfo.bz = "sssss";

                list8.add(logInfo);

            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void initDataAccountCheck() {
        try {
            for (int i = 0; i < 5; i++) {
                TrffWeb.AccountCheck accountCheck = new TrffWeb.AccountCheck();

                if (i == 0) {
                    //决定书编号
                    accountCheck.jdsbh = "198810151013";
                } else if (i == 1) {
                    //决定书编号
                    accountCheck.jdsbh = "197810111018";
                } else if (i == 2) {
                    //决定书编号
                    accountCheck.jdsbh = "196810251112";
                } else if (i == 3) {
                    //决定书编号
                    accountCheck.jdsbh = "197301151011";
                } else if (i == 4) {
                    //决定书编号
                    accountCheck.jdsbh = "199009151015";
                }
                //决定书编号
                //accountCheck.jdsbh = "" + System.currentTimeMillis();
                //决定书类别
                accountCheck.jdslb = "1";
                //证件号码
                accountCheck.zjhm = "421003199910151019";
                //档案编号
                accountCheck.dabh = "123456789012";
                //当事人
                accountCheck.dsr = "王杰";
                //号牌种类
                accountCheck.hpzl = "12";
                //号牌号码
                accountCheck.hphm = "粤A88888";
                //处理机关
                accountCheck.cljg = "广州市公安局";
                //处理时间
                accountCheck.clsj = "2018-08-08";
                //罚款金额
                accountCheck.fkje = "300";
                //滞纳金
                accountCheck.znj = "300";
                //交款日期
                accountCheck.jkrq = "2018-09-08";
                //罚款收据编号
                accountCheck.fksjbh = "123456789012";
                //收款机构
                accountCheck.skjg = "广州市公安局";
                //匹配标记 0-匹配错误 1-匹配成功 2-未匹配
                accountCheck.ppbj = "1";
                //匹配原因 代码code63 dmsm2匹配PPBJ
                accountCheck.ppyy = "2";
                //写入模式 1-系统写入;2-接口写入
                accountCheck.xrms = "1";
                //录入人
                accountCheck.lrr = "王杰";
                //录入时间
                accountCheck.lrsj = "2018-09-08";
                //更新时间
                accountCheck.gxsj = "2018-09-08";
                //信息来源
                accountCheck.xxly = "1";
                //备注
                accountCheck.bz = "sssss";

                // list.add(accountCheck);
                list9.add(accountCheck);

            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void initDataCheckDriver() {
        try {
            for (int i = 0; i < 5; i++) {
                TrffWeb.CheckDriver checkDriver = new TrffWeb.CheckDriver();

                if (i == 0) {
                    //驾驶证号
                    checkDriver.jszh = "421003198810151013";
                } else if (i == 1) {
                    //驾驶证号
                    checkDriver.jszh = "421003197810111018";
                } else if (i == 2) {
                    //驾驶证号
                    checkDriver.jszh = "421003196810251112";
                } else if (i == 3) {
                    //驾驶证号
                    checkDriver.jszh = "421003197301151011";
                } else if (i == 4) {
                    //驾驶证号
                    checkDriver.jszh = "421003199009151015";
                }
                checkDriver.code = "1";
                checkDriver.msg = "可处理，标识为车主本人";
                //checkDriver.jszh = "421003197810161235";
                checkDriver.xm = "王杰";
                checkDriver.hpzl = "1";
                checkDriver.hphm = "粤A88888";
                list10.add(checkDriver);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void initDataIllegalCode() {
        try {
            for (int i = 0; i < 5; i++) {
                TrffWeb.IllegalCode accountCheck = new TrffWeb.IllegalCode();

                if (i == 0) {
                    accountCheck.id = "1209";
                    accountCheck.code = "罚款100 左转弯时，未靠路口中心点左侧转弯的 扣2分";

                } else if (i == 1) {
                    accountCheck.id = "1210";
                    accountCheck.code = "罚款100 通过路口遇放行信号不依次通过的 扣2分";

                } else if (i == 2) {
                    accountCheck.id = "1211";
                    accountCheck.code = "罚款100 通过路口遇停止信号时，停在停止线以内或路口内的 扣2分";

                } else if (i == 3) {
                    accountCheck.id = "1212";
                    accountCheck.code = "罚款100 通过路口向右转弯遇同车道内有车等候放行信号时，不依次停车等候的 扣2分";

                } else if (i == 4) {
                    accountCheck.id = "1213";
                    accountCheck.code = "罚款100 牵引故障机动车时，被牵引的机动车除驾驶人外载人的 扣2分";

                }

                list11.add(accountCheck);

            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] argv) {
        try {
            Object im = new TmriOutAccess();
            String address = "http://localhost:8088/trffweb/services/TmriOutAccess";
            Endpoint.publish(address, im);
/*
            Service service = new Service();
            String url = "http://localhost:8088/trffweb/services/HelloWorld?wsdl";
            Call call = (Call)service.createCall();
            call.setTargetEndpointAddress(new java.net.URL(url));
            call.setOperationName(new QName("http://example","sayHelloWorldFrom"));
            call.addParameter(new QName("from"),org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
            call.setUseSOAPAction(true);
            call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_STRING);
            String result = (String)call.invoke(new Object[]{"Tom"});
            System.out.println(result);*/
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public boolean isEmpty(String str) {
        return str == null || str.length() == 0;
    }
}
